﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using WMSSoft.Lib.WinKStart.Abstract;

namespace WMSSoft.Lib.WinKStart.Model.MenuConfig
{
    public class ConditionItem : CModelBase
    {
        string _Element = "";
        string _Property = "";
        string _Operator = "-eq";
        string _OperatorNextCondition = "ne";
        string _ConditionValue = null;
        int _ValueLength = 0; //0 mean not used

        public ConditionItem() { }

        public ConditionItem(string Element, string Property, string Operator, string Value, int ValueLength = 0)
        {
            _Element = Element;
            _Property = Property;
            _Operator = Operator;
            _ConditionValue = Value;
            _ValueLength = ValueLength;
        }

        public ConditionItem(string Element, string Property, string Operator, string Value, string OperatorNextCondition, int ValueLength = 0)
        {
            _Element = Element;
            _Property = Property;
            _Operator = Operator;
            _ConditionValue = Value;
            _ValueLength = ValueLength;
            _OperatorNextCondition = OperatorNextCondition;
        }
        
        public string Element
        {
            get { return _Element; }
            set
            {
                _Element = value;
                OnPropertyChanged();
            }
        }

        public string Property
        {
            get { return _Property; }
            set
            {
                _Property = value;
                OnPropertyChanged();
            }
        }

        public string Operator
        {
            get { return _Operator; }
            set
            {
                _Operator = value;
                OnPropertyChanged();
            }
        }

        public string ConditionValue
        {
            get { return _ConditionValue; }
            set
            {
                _ConditionValue = value;
                OnPropertyChanged();
            }
        }

        public int ValueLength
        {
            get { return _ValueLength; }
            set
            {
                _ValueLength = value;
                OnPropertyChanged();
            }
        }

        public string OperatorNextCondition
        {
            get { return _OperatorNextCondition; }
            set
            {
                _OperatorNextCondition = value;
                OnPropertyChanged();
            }
        }
    }
}
